package cn.sixth;

public class Dog {
   private String name;
   private int age;
   private String gender;
   private String kind;

   public Dog(){

   }

    public Dog(String name, int age, String gender, String kind) {
       this.setName(name);
       this.setAge(age);
       this.setGender(gender);
       this.setKind(kind);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
       if (gender.equals("雌")||gender.equals("雄")){
           this.gender = gender;
       }else {
           this.gender="雄";
       }

    }

    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public void run(){
       String str=String.format("名字%s,年龄%d,性别%s,种类%s",name,age,this.gender,kind);
       StringBuffer stringBuffer = new StringBuffer(str);
       stringBuffer.append("高兴的跑");
        System.out.println(stringBuffer);
    }

    public void cry(){
        String str=String.format("名字%s,年龄%d,性别%s,种类%s",name,age,this.gender,kind);
        StringBuffer stringBuffer = new StringBuffer(str);
        stringBuffer.append("欢快的叫");
        System.out.println(stringBuffer);
    }

}
